package com.example.myapplication2222;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication2222.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private ActivityMainBinding binding;
    private Button btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//commad + art+f 直接变为属性
        btn = findViewById(R.id.pacBtn);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override

            public void onClick(View view) {
                Intent intent = new Intent();
//                intent.setClass(MainActivity.this,MainActivity2.class);

                intent.setClass(MainActivity.this, ImageViewMainActivity.class);
//                LinearLayout ll = findViewById(R.id.line2222);
//                ll.setVisibility(View.GONE);
                startActivity(intent);


            }
        });
//        /// 多个btn可以这样用
//        btn.setOnClickListener(this);
//        onClick(btn);
    }

    @Override
    public void onClick(View view) {
        Button bbb = (Button) view;
        view.getId();

    }


    public static class MainActivity2 extends AppCompatActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main2);
            TextView vv = findViewById(R.id.ttttt222);
//            vv.setText("333333");
        }
    }
}